/**
 * @file bsp_mpu6050_port.c
 * @author liufeng (liufeng@injoinic.com)
 * @brief bsp mpu6050 port function.
 * @version 0.1
 * @date 2024-11-18
 *
 * @copyright Copyright (c) 2024  injoinic
 *
 */

#include "bsp_mpu6050_port.h"
#include "hal_iic.h"

void mpu6050_periph_init()
{
}

void mpu6050_periph_deinit()
{
}

uint32_t mpu6050_iic_read_byte(
    void* hi2c, uint16_t SlaveAddr, uint16_t MemAddress, uint8_t* data, uint32_t Timeout
)
{
    return hal_i2c_mem_read(hi2c, SlaveAddr, MemAddress, 0, data, 1, Timeout);
}

uint32_t mpu6050_iic_write_byte(
    void* hi2c, uint16_t SlaveAddr, uint16_t MemAddress, uint8_t data, uint32_t Timeout
)
{
    return hal_i2c_mem_write(hi2c, SlaveAddr, MemAddress, 0, &data, 1, Timeout);
}

uint32_t mpu6050_iic_mem_read(
    void* hi2c,
    uint16_t SlaveAddr,
    uint16_t MemAddress,
    uint8_t* pData,
    uint16_t Size,
    uint32_t Timeout
)
{
    return hal_i2c_mem_read(hi2c, SlaveAddr, MemAddress, 0, pData, Size, Timeout);
}

uint32_t mpu6050_iic_mem_read_dma(
    void* hi2c, uint16_t SlaveAddr, uint16_t MemAddress, uint8_t* pData, uint16_t Size
)
{
    return hal_i2c_mem_read_dma(hi2c, SlaveAddr, MemAddress, 0, pData, Size);
}
